<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org/">
<head>
    <meta charset="UTF-8">
    <title>主页</title>
    <div th:replace="header::common_resource"></div>
</head>
<body>
    <form id="formId">
        <input type="text" name="name" />
        <input type="password" name="password" class="pass_input" placeholder="请输入密码" />
        <input type="button" name="" value="登录" onclick="submitForm()">
    </form>

   <script>
       function submitForm() {
           $.post("[[@{/user/login}]]" ,
               $('#formId').serialize(),
               function(jsonResult) {
                   console.log(jsonResult);
                   if(jsonResult.ok) {
                       mylayer.okUrl(jsonResult.msg, '[[@{/}]]');
                   } else {
                       mylayer.errorMsg(jsonResult.msg);
                   }
               },
               'json');
       }
   </script>
</body>
</html>
